package com.labmi.controller.bean;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.bean.ViewScoped;

import com.labmi.experiment.Item;
import com.labmi.experiment.dao.ItemDAO;

@ManagedBean
@SessionScoped
public class SearchController {
	
	private List<String> lastSearchKeys;
	
	private String key;
	
	private Set<String> brandList;
	
	private String selectedBrand;

	private ItemDAO itemDAO;
	
	public SearchController() {
		brandList = new HashSet<String>();
		brandList.add("Armani");
		brandList.add("Versace");
		brandList.add("Cavalli");
		brandList.add("Levis");
	
		
		itemDAO = new ItemDAO();
	}
	
	
	
	
	public List<String> getLastSearchKeys() {
		return lastSearchKeys;
	}

	public void setLastSearchKeys(List<String> lastSearchKeys) {
		this.lastSearchKeys = lastSearchKeys;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public Set<String> getBrandList() {
		return brandList;
	}

	public void setBrandList(Set<String> brandList) {
		this.brandList = brandList;
	}

	public List<Item> search(String currentSelectedCategory) {
		
		 return  itemDAO.searchItemInsideCategory(key, currentSelectedCategory);
	}
	


	public void setSelectedBrand(String selectedBrand) {
		this.selectedBrand = selectedBrand;
	}




	public String getSelectedBrand() {
		return selectedBrand;
	}
	
	
}
